﻿using System;
using System.Globalization;
using System.Windows.Data;
using Microsoft.SharePoint.Administration;

namespace Trentacular.SharePoint.Deployment.Converters
{
    public class SPSolutionDeploymentStateConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var deploymentState = (SPSolutionDeploymentState)value;
            switch (deploymentState)
            {
                case SPSolutionDeploymentState.GlobalAndWebApplicationDeployed:
                    return "Global and Web Application Deployed";
                case SPSolutionDeploymentState.GlobalDeployed:
                    return "Globally Deployed";
                case SPSolutionDeploymentState.NotDeployed:
                    return "Not Deployed";
                case SPSolutionDeploymentState.WebApplicationDeployed:
                    return "Web Application Deployed";
            }
            throw new ArgumentException("Unknown deployment state");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
